<?php

/**
 * 过滤处理
 */

namespace Services;

class Filters
{

    /**
     * 过滤Emoji表情
     *
     * @param $content
     * @return mixed
     */
    public function emoji($content)
    {
        return preg_replace_callback(
            '/./u',
            function (array $match) {
                return strlen($match[0]) >= 4 ? '' : $match[0];
            },
            $content
        );
    }

    /**
     * 过滤字符串
     *
     * @param $str
     * @return mixed
     */
    public function trimBlank($str)
    {
        return str_replace(array(" ","　","\t","\n","\r") , array("","","","",""),$str);
    }
    
}
